package com.example.knowman.ObService.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.knowman.ObService.OBarchLabelMainService;
import com.example.knowman.ObService.OBknowLabelMainService;
import com.example.knowman.entity.archLabelMain;
import com.example.knowman.entity.knowLabelMain;
import com.example.knowman.mapper.ArchLabelMainMapper;
import com.example.knowman.mapper.KnowLabelMainMapper;
import org.springframework.stereotype.Service;

@Service
public class ObArchLabelMainServiceImpl extends ServiceImpl<ArchLabelMainMapper, archLabelMain> implements OBarchLabelMainService {




    @Override
    public archLabelMain getSingle(Integer knowId) {
        return this.lambdaQuery().select().eq(archLabelMain::getKnowId,knowId).one();
    }

    @Override
    public void deleteByKnowId(Integer knowId) {
        QueryWrapper<archLabelMain> wrapper = new QueryWrapper<>();
        wrapper.eq("\"knowId\"",knowId);
        try{
            this.remove(wrapper);
        }catch (Exception e){

        }
    }

    @Override
    public void insertFromKnowMainInsert(Integer knowId, String staffName) {
        archLabelMain temp = new archLabelMain();
        temp.setKnowId(knowId);

        temp.setUserName(staffName);


        try{
            this.save(temp);

        }catch (Exception e){

        }
    }


}
